A wide variety of electronic systems may include a local clock. Examples of devices that may include a local clock are numerous and include computer systems, servers, storage devices, test instruments, industrial control devices, environmental control devices, and appliances.
A local clock may include a counter and an oscillator that generates an oscillator signal that causes the counter to increment its count. For example, an oscillator signal having a frequency of one megahertz may cause a counter to increment its count every microsecond, i.e. to count microseconds. Higher frequency oscillators may be used to provide higher time resolutions.
A local time may be associated with a counter by incrementing the counter with a value other than one. For example an oscillator having a frequency of 250 kHz may be used to increment a counter by four every four microseconds in order to maintain a time count in microseconds. A value by which a counter is incremented depends on the rate of its oscillator compared to a time increment to be counted.
The frequency of an oscillator in a local clock may change over time. For example, the frequency of an oscillator may change in response to changes in temperature or other environmental factors. Changes to the frequency of an oscillator may cause a local clock to run faster at some times and slower at other times, thereby decreasing its accuracy.
One prior technique for improving the accuracy of a local clock is to periodically apply a correction. For example, a correction may be added to or subtracted from a local clock to bring it into agreement with a reference time. Unfortunately, applying a correction to a local clock leaves the local clock free to later drift out of agreement with the reference time. Corrections may be frequently applied to a local clock but at the risk of accumulating excessive quantization errors. For example, a local clock that holds an n bit value has a possible quantization error of 1/n during each addition or subtraction of a correction.